package com.hitqz.robot.api.common.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

@Data
@TableName(value = "form_field_config")
public class FormFieldConfig {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @NotNull(message = "表单id不能为空")
    @Schema(description = "表单id")
    private Integer formId;
    @NotBlank(message = "字段编码不能为空")
    @Schema(description = "字段名称[英文及数字,后台用]")
    private String fieldName;
    @NotBlank(message = "字段标签不能为空")
    @Schema(description = "字段标签[中文,前端显示填写用的]")
    private String fieldLabel;
    @NotNull(message = "字段类型不能为空")
    @Schema(description = "字段类型[text（文本框）、number（数字输入框）、checkbox（复选框）、radio（单选按钮）、select（下拉选择框）select-multiple(下拉多选选择框) 、transfer(穿梭框)]")
    private String fieldType;
    @NotBlank(message = "字段默认值不能为空")
    @Schema(description = "字段默认值")
    private String defaultValue;
    @Schema(description = "字段当前值[有回显，没有则显示和传默认值]")
    private String currentValue;
    @NotNull(message = "字段是否必填不能为空")
    @Schema(description = "字段是否必填")
    private Boolean required;
    @Schema(description = "限制最小值[type为number时可填写]")
    private Integer minValue;
    @Schema(description = "限制最大值[type为number时可填写]")
    private Integer maxValue;
    @Schema(description = "正则表达式校验[type为text时可填写]")
    private String pattern;
    @Schema(description = "下拉框选项[type为checkbox,radio,select时可填写]")
    private String options;
}
